<?php

namespace app\index\controller;

use think\Controller;
use think\Request;
use think\Db;
use think\Session;
class Me extends Controller
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
        //登录处理
        $info = Session::get('user_info');

        $user_id = $info['user_id'];
        $art = Db::name('artcomment')->where('user_id', $user_id)->select();
        $posts = Db::name('post')->where('user_id', $user_id)->select();

        return view('me/index',[
            'user_id' => $info['user_id'],
            'username' => $info['username'],
            'sex' => $info['sex'],
            'age' => $info['age'],
            'userpic' => $info['userpic'],
            'tel' => $info['tel'],
            'email' => $info['email'],
            'integral' => $info['bp'],
            'list' => $art,
            'posts' => $posts
        ]);
    }

}
